$(function(){
	$(".guide-menu li").click(function(){
		$(this).siblings("li").removeClass("active");
		$(this).toggleClass("active")
	})	
	$("body").addClass("loading")	
	setTimeout(function(){
		$("body").removeClass("loading")
		$("#pageloader").addClass("hiden")		
		setTimeout(function(){
			$("#pageloader").remove()
		},2000)					
	},2000)	
	var strs = $(".guide-link a").attr("data-text")
	var lens = strs.length
	setTimeout(function(){
		var myInterval = setInterval(function(){
			var str = $(".guide-link a").text()
			if(str.length<=lens){
				$(".guide-link a").text(str+strs.substr(str.length,1))
			}else{
				clearInterval(myInterval)
			}
		},100)	
	},2000)		
	var coverSwiper = new Swiper('.coverbg .swiper-container',{
		direction : 'vertical',
		speed: 1000,
		loop: true
	})
	var textSwiper = new Swiper('.textbox .swiper-container',{
		speed: 800,
		loop: true,
		pagination: ".textbox .swiper-pagination",
		paginationClickable: true,
		mousewheelControl: true,
		autoplay: 6000,
		autoplayDisableOnInteraction: false,
		onTransitionStart: function(swiper){
			$(".guide .coverbg").addClass("mask")
			setTimeout(function(){
				coverSwiper.slideTo(swiper.activeIndex, 1000, false)
			},1000)	
		},
		onSlideChangeEnd: function(swiper){
			setTimeout(function(){
				$(".guide .coverbg").removeClass("mask")
			},1500)
		}
	})	
	if($(window).width()>=640){
		for(i=0;i<=$(".textbox .swiper-pagination-bullet").length;i++){
			if(i<10){
				$(".textbox .swiper-pagination-bullet").eq(i).append("<em>0"+(i+1)+"</em>")
			}else{
				$(".textbox .swiper-pagination-bullet").eq(i).append("<em>"+(i+1)+"</em>")
			}
		}		
	}
	$(window).resize(function(){
		if($(window).width()>=640){
			for(i=0;i<=$(".textbox .swiper-pagination-bullet").length;i++){
				if(i<10){
					$(".textbox .swiper-pagination-bullet").eq(i).append("<em>0"+(i+1)+"</em>")
				}else{
					$(".textbox .swiper-pagination-bullet").eq(i).append("<em>"+(i+1)+"</em>")
				}
			}		
		}		
	})
})	